index.html.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb breadcrumb_phone_none">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <div class="breadcrumb_box breadcrumb_pc_none">
  23. <span class=" ">当前位置:</span>
  24. <NuxtLink to="/">首页</NuxtLink>
  25. <span class=" ">&gt;</span>
  26. <span class=" ">
  27. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  28. </span>
  29. </div>
  30. <!-- 资讯列表 -->
  31. <div class="newsDetail">
  32. <div class="inner">
  33. <div class="innerDetail">
  34. <div class="headImg"></div>
  35. <div class="innerDetail1">
  36. <div class="leftBottom" v-html="newsDetail.content"></div>
  37. </div>
  38. <div class="footImg"></div>
  39. </div>
  40. <div class="innerLeft phone_none">
  41. <ul>
  42. <li>
  43. 导航列表
  44. </li>
  45. <li v-for="(item, index) in bottomMenu" :key="index">
  46. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  47. :class="item.id == pageId ? 'active' : ''">
  48. {{ item.name }}
  49. </NuxtLink>
  50. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  51. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  52. {{ item.name }}
  53. </NuxtLink>
  54. </li>
  55. </ul>
  56. </div>
  57. <div style="clear: both;"></div>
  58. </div>
  59. </div>
  60. <!-- 广告二 -->
  61. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  62. <!-- 页面底部 -->
  63. <HomeFoot1></HomeFoot1>
  64. </template>
  65. <script setup>
  66. //1.页面依赖 start ---------------------------------------->
  67. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  68. import { ArrowRight } from '@element-plus/icons-vue'
  69. import { ref, onMounted } from 'vue';
  70. //获得跳转过来的id
  71. const route = useRoute();
  72. //获得当前的完整路径
  73. const fullPath = route.path;
  74. //拆分,取出来中间这一段,然后提取数字部分
  75. const segments = fullPath.split('/');
  76. const targetSegment = segments[2];
  77. let num = ref('')
  78. let articleId;
  79. let pageId;
  80. //通过导航路径反向查询导航id
  81. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  82. method: 'GET',
  83. query: {
  84. 'foot_pinyin': targetSegment,
  85. },
  86. });
  87. if (getRouteId.code == 200) {
  88. articleId = getRouteId.data.id;
  89. pageId = getRouteId.data.id;
  90. } else {
  91. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  92. console.log("错误位置:通过url路径查询导航池id")
  93. console.log("后端错误反馈:", getRouteId.message)
  94. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  95. }
  96. //1.页面依赖 end ---------------------------------------->
  97. //2.页面数据 start ---------------------------------------->
  98. //广告列表
  99. const adList = ref([]);
  100. let adImg1 = ref([]);
  101. let adImg2 = ref([]);
  102. async function getAdData() {
  103. const adData = await requestDataPromise('/web/getWebsiteAdvertisement', { method: 'GET', query: { 'ad_tag': 'PAGE' } });
  104. adList.value = adData.data;
  105. if (adData.code == 200) {
  106. for (let item of adData.data) {
  107. if (item.ad_tag == 'PAGE_0001') {
  108. adImg1.value = item;
  109. }
  110. if (item.ad_tag == 'PAGE_0002') {
  111. adImg2.value = item;
  112. }
  113. }
  114. } else {
  115. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  116. console.log("错误位置:获取详情页广告列表")
  117. console.log("后端错误反馈:", adData.message)
  118. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  119. }
  120. }
  121. getAdData();
  122. const newsDetail = ref({})
  123. const bottomMenu = ref([]);
  124. async function getPageData() {
  125. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  126. method: 'GET',
  127. query: {
  128. 'fcat_id': articleId,
  129. 'type': 0,
  130. },
  131. });
  132. newsDetail.value = mkdata.data;
  133. }
  134. getPageData();
  135. async function getPageMenu() {
  136. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  137. method: 'GET',
  138. query: {},
  139. });
  140. if (mkdata.code == 200) {
  141. mkdata.data.forEach((item, index) => {
  142. if (item.id == articleId) {
  143. num.value = index;
  144. }
  145. });
  146. bottomMenu.value = mkdata.data;
  147. }
  148. }
  149. getPageMenu();
  150. //2.页面数据 end ---------------------------------------->
  151. //4.设置seo信息 start---------------------------------------->
  152. //4.1 设置seo信息
  153. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  154. method: 'GET',
  155. query: {},
  156. });
  157. let seoTitle = setData.data.website_head.title;
  158. let seoDescription = setData.data.website_head.description;
  159. let seoKeywords = setData.data.website_head.keywords;
  160. let seoSuffix = setData.data.website_head.suffix;
  161. let seoName = setData.data.website_head.website_name;
  162. useSeoMeta({
  163. title: seoTitle + "_" + seoSuffix,
  164. meta: [
  165. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  166. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  167. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no', tagPriority: 10 }
  168. ]
  169. });
  170. //4.设置seo信息 end---------------------------------------->
  171. onMounted(async () => {
  172. //从客户端获取行政职能部门 加快打开速度
  173. const { $webUrl, $CwebUrl } = useNuxtApp();
  174. //广告1
  175. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmgw_page_0001`
  176. const responseAd1 = await fetch(url, {
  177. headers: {
  178. 'Content-Type': 'application/json',
  179. 'Userurl': $CwebUrl,
  180. 'Origin': $CwebUrl
  181. }
  182. });
  183. const resultAd1 = await responseAd1.json();
  184. adImg1.value = resultAd1.data[0];
  185. //广告2
  186. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmgw_page_0002`
  187. const responseAd2 = await fetch(url2, {
  188. headers: {
  189. 'Content-Type': 'application/json',
  190. 'Userurl': $CwebUrl,
  191. 'Origin': $CwebUrl
  192. }
  193. });
  194. const resultAd2 = await responseAd2.json();
  195. adImg2.value = resultAd2.data[0];
  196. })
  197. </script>
  198. <style lang="less" scoped>
  199. @import '@/assets/css/about.less';
  200. </style>
  201. <style lang="less" scoped>
  202. @media screen and (min-width:801px) {
  203. /*pc*/
  204. .breadcrumb_pc_none {
  205. display: none !important;
  206. }
  207. .pc_none {
  208. display: none;
  209. }
  210. }
  211. @media screen and (max-width:800px) {
  212. /*ipad_phone*/
  213. .breadcrumb_box {
  214. height: 22px;
  215. width: 100%;
  216. margin: 16px auto 9px;
  217. word-break: keep-all;
  218. white-space: nowrap;
  219. overflow: hidden;
  220. text-overflow: ellipsis;
  221. width: 92%;
  222. font-size: 14px;
  223. color: #666;
  224. * {
  225. font-size: 14px;
  226. display: inline;
  227. color: #666;
  228. line-height: 22px;
  229. height: 22px;
  230. margin-right: 5px;
  231. }
  232. }
  233. .newsDetail {
  234. min-height: auto;
  235. }
  236. .newsDetail .inner {
  237. width: 92% !important;
  238. }
  239. .newsDetail .inner .innerDetail {
  240. width: 100%;
  241. margin-bottom: 8px;
  242. }
  243. .newsDetail .inner .innerDetail .innerDetail1 {
  244. width: 100%;
  245. padding: 10px;
  246. }
  247. .newsDetail .inner .innerDetail .headImg {
  248. display: none;
  249. }
  250. .newsDetail .inner .innerDetail .footImg {
  251. display: none;
  252. }
  253. .newsDetail .inner .innerDetail .innerDetail1 {
  254. background: rgba(0, 0, 0, 0);
  255. border: 1px solid #8ac5c0;
  256. }
  257. .newsDetail .inner .innerDetail .leftBottom * {
  258. font-size: 16px !important;
  259. ;
  260. line-height: 22px;
  261. }
  262. .breadcrumb_phone_none {
  263. display: none !important;
  264. }
  265. // .innerLeft{display:none;}
  266. .phone_none {
  267. display: none;
  268. }
  269. }
  270. </style>